package zcw.com.lib_leet_code;

import zcw.com.lib_leet_code.util.Util;

/**
 * Created by 朱城委 on 2021/7/15.<br><br>
 *
 * 构造矩形
 */
public class Topic492 {

    public static void main(String[] args) {
        Topic492 instance = new Topic492();

        Util.printArray(instance.constructRectangle(4));
        Util.printArray(instance.constructRectangle(37));
        Util.printArray(instance.constructRectangle(122122));
    }

    public int[] constructRectangle(int area) {
        for(int i = (int) Math.sqrt(area); i >= 1; i--) {
            if(area % i == 0) {
                return new int[] {area / i, i};
            }
        }

        return new int[] {area, 1};
    }
}
